ContextHelper::is_in_array_comparison(): add basic tests#2726
Merged
Conversation
GaryJones
reviewed
Apr 24, 2026
Collaborator
Author
|
I added a new commit with a negative bare variable test as suggested in #2725 (review) for consistency. |
GaryJones
approved these changes
Apr 25, 2026
9ccc62d to
94dfbaa
Compare
jrfnl
approved these changes
Apr 27, 2026
Member
jrfnl
left a comment
There was a problem hiding this comment.
Thanks @rodrigoprimo ! Looking good again.
One thing I would like to point out - but not a blocker -: these helper functions generally can target any arbitrary token to check if that token is "in an array comparison" or "in isset".
All the tests specifically target variables though, which makes them a little one-dimensional (but doesn't take anything away from the value of having those tests). Having some variation - a test targetting a T_COMMA or a T_STRING function call or constant or something, would also document better that the functions can be used on any type of token.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In preparation for supporting PHPCS 4.0, this PR adds unit tests for the
ContextHelper::is_in_array_comparison()method.Suggested changelog entry
N/A